home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ansi / hercules.zip / HCHARSET.ASM < prev    next >
Assembly Source File  |  1986-09-04  |  2KB  |  98 lines

  1. ;**************************************************************
  2. ;*
  3. ;*    Tests Hercules BIOS, specifically the functions 9 & 10
  4. ;*    to put characters on the screen in graphics mode.
  5. ;*
  6. ;***************************************************************
  7. VIDI    equ    10H        ; video interrupt, 10H (50H for debug)
  8. cseg    segment    common
  9.     assume    cs:cseg,ds:cseg
  10. START    proc
  11. ;            ; prompt for IBM or Hercules graphics mode
  12.     mov    ah,9        ; DOS 9 = display string
  13.     mov    dx,offset mode_prmt+100H
  14.                 ; display mode prompt
  15.     int    21H        ; DOS function
  16.     mov    ah,1        ; DOS 1 = kbd input
  17.     int    21H
  18.     mov    bl,al        ; input char --> BL
  19.     mov    ax,6        ; ibm graphics mode
  20.     cmp    bl,"h"        ; input "h" for Hercules
  21.     jne    i_mode
  22.     add    ax,2        ; hercules mode
  23. i_mode:    int    VIDI
  24. ;
  25.     xor    bh,bh        ; page 0
  26.     mov    bl,7        ; normal attribute
  27.     mov    dh,1        ; cursor at <1,1> to start
  28.     mov    dl,1
  29. ;
  30.     mov    cx,24        ; do 24 rows
  31. row:    push    cx        ; save row counter
  32.     inc    dh        ; next row
  33.     mov    dl,0        ; back to first column
  34.     mov    ah,2        ; cursor move function
  35.     int    VIDI
  36. ;            ; compute video mode
  37.     mov    bl,dh        ; row # to BL
  38.     xor    bh,bh
  39.     shr    bl,1        ; 4 rows per mode
  40.     shr    bl,1
  41.     mov    bl,mode_seq[bx+100H]    ; index into mode sequence for mode
  42. ;
  43. ;            ; for debug, first print [row+64]
  44.     mov    al,dh
  45.     add    al,64
  46.     mov    ah,10        ; fn 10 prints w/o attributes
  47.     mov    cx,1
  48.     int    VIDI
  49. ;
  50.     xor    bh,bh        ; page 0
  51.     mov    cx,64        ; each row 64 characters
  52. achar:    push    cx        ; save char counter
  53.     mov    ah,9        ; write_char function
  54.     mov    al,dh        ; character = col + (row mod 2)*64
  55.     and    al,1        ; row mod 2
  56.     ror    al,1        ; *128
  57.     shr    al,1
  58.     add    al,dl        ; + col
  59.     mov    cx,1        ; write one of them
  60.     int    VIDI
  61.     inc    dl        ; increment row counter
  62.     mov    ah,2        ; cursor move function
  63.     int    VIDI
  64.     pop    cx        ; restore character counter
  65.     loop    achar
  66.     pop    cx        ; restore row counter
  67.     loop    row
  68. ;
  69. ;            ; draw a line where it should start
  70.     mov    dx,5        ; row 5
  71.     mov    cx,0        ; col 0
  72. line:    push    cx
  73.     push    dx
  74.     mov    ax,0C01H    ; function 12=pixel
  75.     int     VIDI
  76.     pop    dx
  77.     pop    cx
  78.     inc    cx        ; step col
  79.     cmp    cx,700        ; ...until 700
  80.     jle    line
  81. ;
  82. ;            ; wait for a keystroke
  83.     mov    ah,1
  84.     int    21H
  85. ;
  86.     mov    ax,7        ; back to alpha mode
  87.     int     VIDI
  88. ;
  89. ;              ; Now return to system
  90.     xor    ax,ax        ; zero --> AX
  91.     int    21H        ; DOS function call 0 - terminate normally
  92. ;
  93. mode_prmt    db    "hercules or ibm mode? [ibm] $"
  94. mode_seq    db    7,0Fh,1,70h,0,9    ; sequence norm,hi,ul,rev,invis,norm
  95. START    endp
  96. cseg    ends
  97.         end     START
  98.